#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[101];
signed main()
{
	int n, m, index = 0;
	while (cin >> n >> m) {
		if (n == 0  && m == 0) {
			break;
		}
		for (int i = 0; i < n; i++) {
			cin >> a[i];
			if (m > a[i]) {
				index  = i + 1;
			}
		}

		for (int i = n - 1; i >= index; i--) {
			a[i + 1] = a[i];
		}
		a[index] = m;
		for (int i = 0; i < n + 1; i++) {
			cout << a[i] << " ";
		}
	}
	return 0;
}
